// 登录日志路由
import { Router } from "express";
import loginInfoController from "@/controllers/monitor/loginInfo.controller";
import { authMiddleware } from "@/middlewares/auth.middleware";
import { permissionMiddleware } from "@/middlewares/permission.middleware";

const router = Router();

/**
 * 登录日志监控路由
 * 路径前缀：/monitor/loginInfo
 */

// ================== 登录日志相关 ==================

// 所有路由均需认证
router.use(authMiddleware);

// 查询登录日志列表
router.get("/list", permissionMiddleware("monitor:logininfor:list"), loginInfoController.list);

// 导出登录日志
router.post("/export", permissionMiddleware("monitor:logininfor:export"), loginInfoController.export);

// 清空登录日志
router.delete("/clean", permissionMiddleware("monitor:logininfor:remove"), loginInfoController.clean);

// 删除登录日志
router.delete("/:infoIds", permissionMiddleware("monitor:logininfor:remove"), loginInfoController.remove);

// 解锁用户登录状态
router.get("/unlock/:userName", permissionMiddleware("monitor:logininfor:unlock"), loginInfoController.unlock);

export default router;
